function _defineProperty(t, e, i) {
    return e in t ? Object.defineProperty(t, e, {
        value: i,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[e] = i, t;
}

var app = getApp();

function changeArray(t, e) {
    console.log(t);
    for (var i = 0, a = t.length; i < a; i++) t[i].goodcom = 0, t[i].anonymity = !1, 
    t[i].imgs = [], t[i].text = "", t[i].coment && (t[i].goodcom = t[i].coment.goodcom, 
    t[i].imgs = t[i].coment.imgs, t[i].text = t[i].coment.text, t[i].anonymity = "-1" != t[i].coment.anonymity, 
    0 == e.data.logistics_speed && (e.data.logistics_speed = t[i].coment.logistics_speed), 
    0 == e.data.service_attitude && (e.data.service_attitude = t[i].coment.service_attitude)), 
    e.setData({
        list: t,
        logistics_speed: e.data.logistics_speed,
        service_attitude: e.data.service_attitude
    });
    return t;
}

Page({
    data: {
        start: [ "非常差", "差", "一般", "好", "非常好" ],
        service_attitude: 0,
        logistics_speed: 0
    },
    goodCom: function(t) {
        console.log(t), console.log(this.data.list);
        var e = t.currentTarget.dataset.index;
        console.log(e), this.setData(_defineProperty({}, "list[" + e + "].goodcom", t.currentTarget.dataset.current));
    },
    serviceAttitude: function(t) {},
    logisticsSpeed: function(t) {},
    addImage: function(t) {
        var a = t.currentTarget.dataset.index, o = this;
        wx.chooseImage({
            count: 9 - o.data.list[a].imgs.length,
            sizeType: [ "compressed" ],
            success: function(t) {
                var e = t.tempFiles, i = o.data.list[a].imgs;
                e.forEach(function(t, e) {
                    204800 < t.size ? app.look.alert("图片尺寸过大") : i.push(t.path);
                }), o.setData(_defineProperty({}, "list[" + a + "].imgs", i));
            }
        });
    },
    delImg: function(t) {
        var e = t.currentTarget.dataset.imgIndex, i = t.currentTarget.dataset.index, a = this.data.list[i].imgs;
        a.splice(e, 1), this.setData(_defineProperty({}, "list[" + i + "].imgs", a));
    },
    myform: function(t) {
        for (var e = this.data.list, i = 0, a = e.length; i < a; i++) if (0 == e[i].goodcom) return void app.look.alert("商品评分?");
        if (0 != this.data.service_attitude) if (0 != this.data.logistics_speed) {
            var o = this;
            for (i = 0, a = e.length; i < a; i++) 0 < e[i].imgs.length && (wx.showLoading({
                title: "上传图片中"
            }), e[i].imgs = app.look.updata(e[i].imgs), wx.hideLoading()), delete e[i].img, 
            e[i].anonymity ? e[i].anonymity = 1 : e[i].anonymity = -1;
            app.util.request({
                url: "entry/wxapp/my",
                showLoading: !0,
                method: "POST",
                data: {
                    op: "sendComment",
                    list: JSON.stringify(e),
                    service_attitude: o.data.service_attitude,
                    logistics_speed: o.data.logistics_speed,
                    order_id: o.options.id
                },
                success: function(t) {
                    app.look.ok(t.data.message, function() {
                        wx.redirectTo({
                            url: "/xc_xinguwu/pages/order/order?status=4"
                        });
                    });
                }
            });
        } else app.look.alert("物流发货速度?"); else app.look.alert("商家服务态度?");
    },
    blak: function(t) {
        wx.redirectTo({
            url: "/xc_xinguwu/pages/order/order?status=5"
        });
    },
    previewImage: function(t) {
        var e = t.currentTarget.dataset.index, i = t.currentTarget.dataset.img_idnex;
        wx.previewImage({
            urls: this.data.list[e].imgs,
            current: this.data.list[e].imgs[i]
        });
    },
    inputValue: function(t) {
        var e = t.currentTarget.dataset.index;
        this.setData(_defineProperty({}, "list[" + e + "].text", t.detail.value));
    },
    onLoad: function(t) {
        this.options = t;
        var i = this;
        app.util.request({
            url: "entry/wxapp/my",
            showLoading: !1,
            data: {
                op: "commented",
                order_id: t.id
            },
            success: function(t) {
                var e = t.data;
                e.data.list && changeArray(e.data.list, i);
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {}
});